﻿using Microsoft.EntityFrameworkCore;
using WMS.FC.Domain.PersistenceObject.Business;
using WMS.FC.Domain.Repository;
using WMS.FC.Infrastructure.Common;

namespace WMS.FC.Infrastructure.Repository
{
    public class LocationRepository : RepositoryBase, ILocationRepository
    {
        public LocationRepository(WmsDbContext dbContext) : base(dbContext)
        {

        }

        public async Task<LocationPO?> GetLocationByCode(string locationCode)
        {
            return await dbContext.Set<LocationPO>().AsNoTrackingWithIdentityResolution().FirstOrDefaultAsync(entity => entity.Code == locationCode);
        }
    }
}
